<template xmlns:el-col="http://www.w3.org/1999/html">
	<div class="app-container">
		<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="120px">
			<el-form-item label="工单编号" prop="borrowNo">
				<el-input v-model="queryParams.borrowNo" placeholder="请输入工单编号" clearable @keyup.enter="handleQuery" />
			</el-form-item>
			<el-form-item label="借阅状态" prop="giveBackStatus">
				<el-select v-model="queryParams.giveBackStatus" placeholder="请选择借阅状态">
					<el-option v-for="dict in order_give_back_status" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="借阅人姓名" prop="borrowUserName">
				<el-input v-model="queryParams.borrowUserName" placeholder="请输入借阅人姓名" clearable @keyup.enter="handleQuery" />
			</el-form-item>
			<el-form-item label="借出日期" style="width:400px;">
				<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
				 start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
				<el-button icon="Refresh" @click="resetQuery">重置</el-button>
			</el-form-item>
		</el-form>

		<el-row :gutter="10" class="mb8">
			<!--      <el-col :span="1.5">-->
			<!--        <el-button-->
			<!--          type="primary"-->
			<!--          plain-->
			<!--          icon="Plus"-->
			<!--          @click="handleAdd"-->
			<!--          v-hasPermi="['archive:borrowTask:add']"-->
			<!--        >新增</el-button>-->
			<!--      </el-col>-->
			<!--      <el-col :span="1.5">-->
			<!--        <el-button-->
			<!--          type="success"-->
			<!--          plain-->
			<!--          icon="Edit"-->
			<!--          :disabled="single"-->
			<!--          @click="handleUpdate"-->
			<!--          v-hasPermi="['archive:borrowTask:edit']"-->
			<!--        >修改</el-button>-->
			<!--      </el-col>-->
			<!--      <el-col :span="1.5">-->
			<!--        <el-button-->
			<!--          type="danger"-->
			<!--          plain-->
			<!--          icon="Delete"-->
			<!--          :disabled="multiple"-->
			<!--          @click="handleDelete"-->
			<!--          v-hasPermi="['archive:borrowTask:remove']"-->
			<!--        >删除</el-button>-->
			<!--      </el-col>-->
			<!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="Download"
          @click="handleExport"
          v-hasPermi="['archive:borrowTask:export']"
        >导出</el-button>
      </el-col> -->
			<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
		</el-row>

		<el-table v-loading="loading" :data="borrowTaskList" @selection-change="handleSelectionChange">
			<!-- <el-table-column type="selection" width="55" align="center" /> -->
			<el-table-column label="序号" align='center' width="50">
				<template #default="scope">
					{{ scope.$index+1 }}
				</template>
			</el-table-column>
			<el-table-column label="借阅人供电单位编号" align="center" prop="borrowOrgNo" width="200" />
			<el-table-column label="工单编号" align="center" prop="borrowNo" width="150" />
			<!--      <el-table-column label="档案室编号" align="center" prop="roomNo" />-->
			<!--1内部人员 2外部人员-->
			<el-table-column label="下发借阅状态" align="center" prop="operType" width="150">
				<template #default="scope">
					<dict-tag :options="oper_type" :value="scope.row.operType" />
				</template>
			</el-table-column>
			<el-table-column label="本地借阅状态" align="center" prop="giveBackStatus" width="150">
				<template #default="scope">
					<dict-tag :options="order_give_back_status" :value="scope.row.giveBackStatus" />
				</template>
			</el-table-column>
			<el-table-column label="借阅人类型" align="center" prop="borrowUserType" width="100">
				<template #default="scope">
					<dict-tag :options="borrow_person_type" :value="scope.row.borrowUserType" />
				</template>
			</el-table-column>
			<el-table-column label="借阅人姓名" align="center" prop="borrowUserName" width="120" />
			<el-table-column label="联系方式" align="center" prop="borrowPhone" width="110" />
			<el-table-column label="利用方式" align="center" prop="utilizationMethod" width="80">
				<template #default="scope">
					<dict-tag :options="borrow_method" :value="scope.row.utilizationMethod" />
				</template>
			</el-table-column>
			<!--      <el-table-column label="借阅类型" align="center" prop="borrowType" />  1电子档案 2纸质档案-->
			<el-table-column label="借阅类型" align="center" prop="borrowType" width="80">
				<template #default="scope">
					<dict-tag :options="borrow_type" :value="scope.row.borrowType" />
				</template>
			</el-table-column>
			<el-table-column label="借阅天数" align="center" prop="borrowDay" width="80" />

			<!--      <el-table-column label="归还日期" align="center" prop="giveBackTime" width="180">-->
			<!--        <template #default="scope">-->
			<!--          <span>{{ parseTime(scope.row.giveBackTime, '{y}-{m}-{d}') }}</span>-->
			<!--        </template>-->
			<!--      </el-table-column>-->

			<!--  <el-table-column label="归还操作员" align="center" prop="giveBackBy"  width="160"/> -->

			<el-table-column label="借出日期" align="center" prop="borrowTime" width="160">
				<template #default="scope">
					<span>{{ parseTime(scope.row.borrowTime) }}</span>
				</template>
			</el-table-column>
			<el-table-column label="借阅原因" align="center" prop="borrowReason" width="200" />
			<el-table-column label="操作" align="center" fixed="right" width="150">
				<!--        <template #default="scope">-->
				<!--          <el-button-->
				<!--            type="text"-->
				<!--            icon="Edit"-->
				<!--            @click="handleUpdate(scope.row)"-->
				<!--            v-hasPermi="['archive:borrowTask:edit']"-->
				<!--          >修改</el-button>-->
				<!--          <el-button-->
				<!--            type="text"-->
				<!--            icon="Delete"-->
				<!--            @click="handleDelete(scope.row)"-->
				<!--            v-hasPermi="['archive:borrowTask:remove']"-->
				<!--          >删除</el-button>-->
				<!--        </template>-->
				<template #default="scope">
					<el-button type="text" icon="View" @click="handleView(scope.row, scope.$index+1)" v-hasPermi="['archive:borrowTask:query']">详情</el-button>
					<!-- &nbsp;
					<el-link v-if="scope.row.giveBackStatus == 1" type="success" icon="Upload" @click="taskReport(scope.row, scope.$index+1,1)"
					 v-hasPermi="['archive:borrowTask:edit']">借阅上报</el-link> -->
				</template>
			</el-table-column>
		</el-table>

		<pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
		 @pagination="getList" />

		<!-- 查看详情 -->
		<el-dialog title="借阅任务详细" v-model="openscan" width="90%" append-to-body>
			<el-form ref="borrowTaskRef" :model="form" label-width="170px">
				<el-row>
					<el-col :span="6">
						<el-form-item label="工单编号" prop="borrowNo">
							<el-input v-model="form.borrowNo" style="width:230px;" disabled="disabled" />
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借阅人姓名" prop="borrowUserName">
							<el-input v-model="form.borrowUserName" style="width:230px;" disabled="disabled" />
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借阅人类型" prop="borrowUserType">
							<el-select v-model="form.borrowUserType" style="width:230px;" disabled="disabled">
								<el-option v-for="dict in borrow_person_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借阅人联系方式" prop="borrowPhone">
							<el-input v-model="form.borrowPhone" style="width:230px;" disabled="disabled" />
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="利用方式" prop="utilizationMethod">
							<el-select v-model="form.utilizationMethod" style="width:230px;" disabled="disabled">
								<el-option v-for="dict in borrow_method" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借阅天数" prop="borrowDay">
							<el-input v-model="form.borrowDay" placeholder="请输入借阅天数" number maxlength="10" style="width:230px;" disabled="disabled" />
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借出申请时间" prop="borrowTime">
							<el-input v-model="form.borrowTime" style="width:230px;" disabled="disabled" />
							<!--              <el-date-picker clearable-->
							<!--                              v-model="form.borrowTime"-->
							<!--                              type="datetime"-->
							<!--                              value-format="YYYY-MM-DD HH:mm:ss"-->
							<!--                              disabled="disabled">-->
							<!--              </el-date-picker>-->
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="借阅原因" prop="borrowReason">
							<el-input v-model="form.borrowReason" type="textarea" :rows="2" style="width:230px;" disabled="disabled" />
						</el-form-item>
					</el-col>
				</el-row>
				<!--        <el-divider content-position="center">借阅明细数据信息</el-divider>-->
				<el-row :gutter="10" class="mb8">
					<el-col :span="1.5">
						<el-button type="primary" icon="FolderRemove" @click="handleBorrow" v-hasPermi="['archive:borrowTask:edit']">借阅</el-button>
					</el-col>

					<el-col :span="1.5">
						<el-button type="success" icon="FolderAdd" @click="handleReturn" v-hasPermi="['archive:borrowTask:edit']">归还</el-button>
					</el-col>
					<!--                <el-col :span="1.5">-->
					<!--                  <el-button-->
					<!--                    type="success"-->
					<!--                    icon="Delete"-->
					<!--                    @click="submitBorrow"-->
					<!--                    v-hasPermi="['archive:borrowTask:edit']"-->
					<!--                  >借阅上报</el-button>-->
					<!--                </el-col>-->
					<!--          <el-col :span="1.5">-->
					<!--            <el-button-->
					<!--                type="success"-->
					<!--                icon="Download"-->
					<!--                @click="submitReturn"-->
					<!--                v-hasPermi="['archive:borrowTask:edit']"-->
					<!--            >归还上报</el-button>-->
					<!--          </el-col>-->
				</el-row>
				<el-row>
					<el-table :data="archiveBorrowList" :row-class-name="rowArchiveBorrowIndex" @selection-change="handleArchiveBorrowSelectionChange"
					 ref="archiveBorrow" style="min-height: 450px;max-height: 450px;border:1px solid #dcdfe6;" height="450" border>
						<el-table-column type="selection" width="50" align="center" />
						<!--            <el-table-column label="序号" align="center" prop="index" width="100"/>-->
						<el-table-column label="序号" align='center' width="100">
							<template #default="scope">
								{{ scope.$index+1 }}
							</template>
						</el-table-column>

						<el-table-column label="借阅状态" align="center" prop="giveBackStatus" width="100">
							<template #default="scope">
								<dict-tag :options="borrow_flag" :value="scope.row.giveBackStatus" />
							</template>
						</el-table-column>
						<el-table-column label="归还操作员" prop="giveBackBy" width="130" align="center">
						</el-table-column>
						<el-table-column label="归还时间" prop="giveBackTime" width="170" align="center">
						</el-table-column>
						<el-table-column label="实际借出日期" prop="actualBorrowTime" width="170" align="center" />
						<el-table-column label="档案区编号" width="150" align="center" prop="areaNo" />
						<el-table-column label="档案柜编号" align="center" prop="cabinetNo" width="150" />
						<el-table-column label="档案盒号" align="center" prop="boxNo" width="150" />
						<el-table-column label="档案盒位置" align="center" prop="storLoc" width="300" />
						<el-table-column label="档案名称" align="center" prop="archiveName" width="330" />
						<el-table-column label="档案类型" align="center" prop="archiveType" width="150">
							<template #default="scope">
								<dict-tag :options="archive_type" :value="scope.row.archiveType" />
							</template>
						</el-table-column>
						<el-table-column label="档案密级" align="center" prop="conLevel" width="100">
							<template #default="scope">
								<dict-tag :options="confd_lv" :value="scope.row.conLevel" />
							</template>
						</el-table-column>
						<el-table-column label="保管期限" align="center" prop="saveDate" width="100">
							<template #default="scope">
								<dict-tag :options="keep_dur" :value="scope.row.saveDate" />
							</template>
						</el-table-column>
						<el-table-column label="资料种类	" align="center" prop="meansType" width="150">
							<template #default="scope">
								<dict-tag :options="means_type" :value="scope.row.meansType" />
							</template>
						</el-table-column>
						<el-table-column label="介质类型" align="center" prop="medForm">
							<template #default="scope">
								<dict-tag :options="med_form" :value="scope.row.medForm" />
							</template>
						</el-table-column>
						<el-table-column label="对象类型" align="center" prop="archObjType" width="150">
							<template #default="scope">
								<dict-tag :options="arch_obj_type" :value="scope.row.archObjType" />
							</template>
						</el-table-column>
						<el-table-column label="对象编号" align="center" prop="archObjNo" width="150" />
						<el-table-column label="对象名称" align="center" prop="archObjName" />
					</el-table>
				</el-row>
			</el-form>
			<template #footer>
				<div class="dialog-footer">
					<el-button @click="closeborrow()">关 闭</el-button>
				</div>
			</template>
		</el-dialog>
	</div>
</template>

<script setup name="BorrowTask">
	import {
		listBorrowTask,
		getBorrowTask,
		delBorrowTask,
		addBorrowTask,
		updateBorrowTask,
		selectArcBoxByTaskId,
		selectArcBoxById,
		editBorrowTaskById,
		report
	} from "@/api/archive/borrowTask";
	import {
		getCurrentInstance,
		reactive,
		ref,
		toRefs
	} from "vue";
	import {
		listStorage
	} from "@/api/archive/storage";
	const {
		proxy
	} = getCurrentInstance();
	const borrowTaskList = ref([]);
	let archiveBorrowList = ref([]);
	let archiveBorrowTemp = ref([]);
	const archiveBoxList = ref([]); //
	const open = ref(false);
	const loading = ref(true);
	const showSearch = ref(true);
	const ids = ref([]);
	const checkedArchiveBorrow = ref([]);
	const single = ref(true);
	const multiple = ref(true);
	const total = ref(0);
	const title = ref("");
	const dateRange = ref([]);
	const data = reactive({
		form: {},
		queryParams: {
			pageNum: 1,
			pageSize: 10,
			orgNo: null,
			roomNo: null,
			borrowOrgNo: null,
			borrowNo: null,
			borrowUserType: null,
			borrowUserName: null,
			borrowPhone: null,
			utilizationMethod: null,
			borrowType: null,
			borrowDay: null,
			borrowTime: null,
			giveBackTime: null,
			estimateTime: null,
			giveBackStatus: null,
			giveBackBy: null,
			borrowReason: null,
			pushStatus: null,
			creator: null,
			modifyTime: null,
			modifier: null
		},
		rules: {},
		// DAqueryParams: {
		//   pageNum: 1,
		//   pageSize: 10,
		//   roomNo: null,
		//   cabinetNo: null,
		//   boxNo: null,
		//   custNo: null,
		//   custName: null,
		//   archiveType: null,
		//   archiveName: null,
		//   saveStatus: null,
		//   saveDate: null,
		//   conLevel: null,
		//   creator: null,
		//   modifyTime: null,
		//   modifier: null
		// },
	});
	const openscan = ref(false);
	const idsd = ref([]);
	const singled = ref(true);
	const multipled = ref(true);
	let isAll = ref(true);
	// const openboxda = ref(false);
	// const DAtitle = ref("");
	const {
		queryParams,
		form,
		rules
	} = toRefs(data);
	const {
		push_status,
		borrow_type,
		borrow_flag,
		borrow_person_type,
		borrow_method,
		in_out_status,
		save_year,
		secrecy_level,
		order_give_back_status,
		archive_type,
		save_extended,
		keep_dur,
		confd_lv,
		med_form,
		means_type,
		arch_obj_type,
		oper_type
	} = proxy.useDict('push_status', 'borrow_type', 'order_give_back_status', 'borrow_flag', 'borrow_person_type',
		'borrow_method', 'in_out_status', 'save_year', 'secrecy_level', 'archive_type',
		'save_extended', 'keep_dur', 'confd_lv', 'med_form', 'means_type', 'arch_obj_type','oper_type');

	function closeborrow() {
		openscan.value = false;
		getList();
	}
	// const roomArchiveList = ref([]);
	// const DAtotal = ref(0);
	/** 查询借阅任务列表 */
	function getList() {
		loading.value = true;
		//listBorrowTask(queryParams.value).then(response => {
		listBorrowTask(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
			borrowTaskList.value = response.rows;
			total.value = response.total;
			loading.value = false;
		});
	}

	// 取消按钮
	function cancel() {
		open.value = false;
		reset();
	}

	// 表单重置
	function reset() {
		form.value = {
			taskId: null,
			orgNo: null,
			roomNo: null,
			borrowOrgNo: null,
			borrowNo: null,
			borrowUserType: null,
			borrowUserName: null,
			borrowPhone: null,
			utilizationMethod: null,
			borrowType: null,
			borrowDay: null,
			borrowTime: null,
			giveBackTime: null,
			estimateTime: null,
			giveBackStatus: "0",
			giveBackBy: null,
			borrowReason: null,
			pushStatus: "0",
			createTime: null,
			creator: null,
			modifyTime: null,
			modifier: null
		};
		archiveBorrowList.value = [];
		archiveBoxList.value = [];
		proxy.resetForm("borrowTaskRef");
	}

	function resetList() {
		archiveBorrowList.value = [];
		archiveBoxList.value = [];
	}
	/** 搜索按钮操作 */
	function handleQuery() {
		queryParams.value.pageNum = 1;
		getList();
	}

	/** 重置按钮操作 */
	function resetQuery() {
		dateRange.value = [];
		proxy.resetForm("queryRef");
		handleQuery();
	}

	// 多选框选中数据
	function handleSelectionChange(selection) {
		ids.value = selection.map(item => item.taskId);
		single.value = selection.length != 1;
		multiple.value = !selection.length;
	}

	/** 新增按钮操作 */
	function handleAdd() {
		reset();
		open.value = true;
		title.value = "添加借阅任务";
	}

	/** 修改按钮操作 */
	function handleUpdate(row) {
		reset();
		const taskId = row.taskId || ids.value
		getBorrowTask(taskId).then(response => {
			form.value = response.data;
			archiveBorrowList.value = response.data.borrowInfo;
			open.value = true;
			title.value = "修改借阅任务";
		});
	}

	/** 提交按钮 */
	function submitForm() {
		proxy.$refs["borrowTaskRef"].validate(valid => {
			if (valid) {
				form.value.archiveBorrowList = archiveBorrowList.value;
				if (form.value.taskId != null) {
					form.value.updatetime = new Date().getTime();
					updateBorrowTask(form.value).then(response => {
						proxy.$modal.msgSuccess("修改成功");
						open.value = false;
						getList();
					});
				} else {
					form.value.createDate = new Date().getTime();
					addBorrowTask(form.value).then(response => {
						proxy.$modal.msgSuccess("新增成功");
						open.value = false;
						getList();
					});
				}
			}
		});
	}

	/** 删除按钮操作 */
	function handleDelete(row) {
		const taskIds = row.taskId || ids.value;
		proxy.$modal.confirm('是否确认删除借阅工单编号为"' + taskIds + '"的数据项？').then(function() {
			return delBorrowTask(taskIds);
		}).then(() => {
			getList();
			proxy.$modal.msgSuccess("删除成功");
		}).catch(() => {});
	}

	/** 借阅信息数据序号 */
	function rowArchiveBorrowIndex({
		row,
		rowIndex
	}) {
		row.index = rowIndex + 1;
	}

	/** 借阅信息数据添加按钮操作 */
	function handleAddArchiveBorrow() {
		let obj = {};
		obj.custNo = "";
		obj.custName = "";
		obj.archiveType = "";
		obj.archiveName = "";
		obj.boxNo = "";
		obj.houseLocationNo = "";
		obj.orderNo = "";
		obj.flowName = "";
		obj.libraryStatus = "";
		obj.giveBackStatus = "";
		archiveBorrowList.value.push(obj);
	}

	/** 借阅信息数据删除按钮操作 */
	function handleDeleteArchiveBorrow() {
		if (checkedArchiveBorrow.value.length == 0) {
			proxy.$modal.msgError("请先选择要删除的借阅信息数据数据");
		} else {
			const archiveBorrows = archiveBorrowList.value;
			const checkedArchiveBorrows = checkedArchiveBorrow.value;
			archiveBorrowList.value = archiveBorrows.filter(function(item) {
				return checkedArchiveBorrows.indexOf(item.index) == -1
			});
		}
	}

	/** 复选框选中数据 */
	function handleArchiveBorrowSelectionChange(selection) {
		checkedArchiveBorrow.value = selection.map(item => item.index);
		idsd.value = selection.map(item => item.id);
		singled.value = selection.length != 1;
		multipled.value = !selection.length;
	}

	/** 导出按钮操作 */
	function handleExport() {
		proxy.download('archive/borrowTask/export', {
			...queryParams.value
		}, `借阅管理_${new Date().getTime()}.xlsx`)
	}

	function handleView(row) {
		openscan.value = true;
		// form.value = row;
		const taskId = row.taskId;
		getBorrowTask(taskId).then(response => {
			form.value = response.data;
			archiveBorrowList.value = response.data.borrowInfo;
		});
	}
	//保存借阅状态
	function handleBorrow(row) {
		let detailIds = row.id || idsd.value;
		if (detailIds == null || detailIds == '') {
			proxy.$modal.msgError("选择信息列表为空");
		} else {
			//alert('提交借阅'+detailIds);
			let msg = '';
			detailIds.forEach((index) => {
				archiveBorrowList.value.findIndex(function(item) {
					if (index == item.id) {
						if (item.giveBackStatus == 1) {
							msg = msg + "档案名称【" + item.archiveName + "】状态为【已借阅】;"
						}
						if (item.giveBackStatus == 3) {
							msg = msg + "档案名称【" + item.archiveName + "】状态为【已归还】;"
						}
					}
				});
			});
			if (msg == '') {
				proxy.$modal.confirm('确认更改选择的档案为已借阅？').then(function() {
					detailIds.unshift('01');
					editBorrowTaskById(detailIds).then(response => {
						proxy.$modal.msgSuccess("借阅成功");
						handleView({
							taskId: form.value.taskId
						})
					}).catch(() => {
						proxy.$modal.msgError("借阅失败");
					});
				})
			} else {
				proxy.$modal.msgError(msg + '请您重新选择！');
			}
		}
	}
	//保存归还状态
	function handleReturn(row) {
		const detailId = row.id || idsd.value;
		if (detailId == null || detailId == '') {
			proxy.$modal.msgError("选择信息列表为空");
		} else {
			let msg = '';
			detailId.forEach((index) => {
				archiveBorrowList.value.findIndex(function(item) {
					if (index == item.id) {
						if (item.giveBackStatus == 2) {
							msg = msg + "档案名称【" + item.archiveName + "】状态为【未借阅】;"
						}
						if (item.giveBackStatus == 3) {
							msg = msg + "档案名称【" + item.archiveName + "】状态为【已归还】;"
						}
					}
				});
			});
			if (msg == '') {
				proxy.$modal.confirm('确认更改选择的档案为已归还？').then(function() {
					detailId.unshift('02');
					editBorrowTaskById(detailId).then(response => {
						proxy.$modal.msgSuccess("归还成功");
						handleView({
							taskId: form.value.taskId
						})
					}).catch(() => {
						proxy.$modal.msgError("归还失败");
					});
				})
			} else {
				//  console.log(msg);
				proxy.$modal.msgError(msg + '请您重新选择！');
			}
		}
	}
	// function submitBorrow(row) {
	//   const taskId = row.taskId;
	//   archiveBorrowTemp=[];
	//   let isAll=true;
	//   getBorrowTask(taskId).then(response => {
	//     archiveBorrowTemp.value = response.data.borrowInfo;
	//     archiveBorrowTemp.value.forEach(function(item){
	//       if(item.giveBackStatus!=1){
	//         isAll=false;
	//       }
	//     });
	//     if(!isAll){
	//       proxy.$modal.msgError('存在未全部借阅的明细，上报失败！');
	//     }
	//     else{
	//       //调用后台接口
	//       alert('借阅上报成功');
	//     }
	//   });
	//
	//
	// }
	// function submitReturn(row) {
	//   const taskId = row.taskId;
	//   archiveBorrowTemp=[];
	//   getBorrowTask(taskId).then(response => {
	//     archiveBorrowTemp.value = response.data.borrowInfo;
	//     archiveBorrowTemp.value.forEach(function(item){
	//       if(item.giveBackStatus!=3){
	//         isAll=false;
	//       }
	//     });
	//     if(!isAll){
	//       proxy.$modal.msgError('存在未全部归还的明细，上报失败！');
	//     }
	//     else{
	//       //调用后台接口
	//       alert('归还上报成功');
	//     }
	//   });
	//
	// }

	/**
	 * 上报
	 */
	function taskReport(row, index, reportType) {
		if (reportType == '1') {
			if (row.pushStatus == '01') {
				proxy.$modal.msgWarning("工单【" + row.borrowNo + "】已借阅上报,不需要重复上报！");
				return;
			}
		} else {
			if (row.returnPushStatus == '01') {
				proxy.$modal.msgWarning("工单【" + row.borrowNo + "】已归还上报,不需要重复上报！");
				return;
			}
		}

		if (row.giveBackStatus == '3') {
			proxy.$modal.msgWarning("工单【" + row.borrowNo + "】待借阅！");
			return;
		}
		report({
			borrowNo: row.borrowNo,
			giveBackStatus: row.giveBackStatus,
			reportType: reportType
		}).then(res => {
			if (row.giveBackStatus == '1') {
				proxy.$modal.msgSuccess("工单【" + row.borrowNo + "】借阅上报成功！");
				getList();
			} else if (row.giveBackStatus == '2') {
				proxy.$modal.msgSuccess("工单【" + row.borrowNo + "】归还上报成功！");
				getList();
			}
		})
	}

	// function handleView(row) {
	//   openscan.value = true;
	//   // form.value = row;
	//   const taskId = row.taskId;
	//   // 主表
	//   getBorrowTask(taskId).then(response => {
	//     form.value = response.data;
	//    // archiveBorrowList.value = response.data.borrowInfo;
	//   });
	//   //档案盒
	//   // selectArcBoxByTaskId(taskId).then(response => {
	//   //   resetList();
	//   //   for (const key in response.data) {
	//   //     let obj = {};
	//   //     obj.boxId = response.data[key].boxId;
	//   //     obj.boxCode = key;
	//   //     obj.boxName = response.data[key].boxName;
	//   //     obj.specs = response.data[key].specs;
	//   //     obj.boxRfid = response.data[key].boxRfid;
	//   //     obj.taskId = taskId;
	//   //     archiveBoxList.value.push(obj);
	//   //   }
	//   // });
	//   selectArcBoxById(taskId).then(response=>{
	//     //console.log('selectArcBoxById'+response.data);
	//     resetList();
	//       for (const key in response.data) {
	//         let obj = {};
	//         obj.boxId = response.data[key].boxId;
	//         obj.boxCode = key;
	//         obj.boxName = response.data[key].boxName;
	//         obj.specs = response.data[key].specs;
	//         obj.boxRfid = response.data[key].boxRfid;
	//         obj.taskId = taskId;
	//         //  "giveBackStatus": "1"
	//         obj.giveBackStatus = response.data[key].giveBackStatus;
	//         archiveBoxList.value.push(obj);
	//       }
	//   });
	//
	//
	//
	// }
	//   function handleViewDetail(taskId,boxcode) {
	//     getBorrowTask(taskId).then(response => {
	//       archiveBorrowList.value = response.data.borrowInfo.filter(s=>s.boxNo==boxcode);
	//     });
	// }
	// function getDAListByBox(boxid) {
	//   openboxda.value=true;
	//   DAtitle.value = boxid+"档案盒内详情";
	//   //档案盒内档案详情
	//   DAqueryParams.value.boxNo=boxid;
	//   listRoomArchive(DAqueryParams.value).then(response => {
	//     roomArchiveList.value = response.rows;
	//     DAtotal.value = response.total;
	//   });
	// }
	getList();
</script>
